<template>
  <div class="hamburger-container">
    <!-- svg-icon组件，用于显示菜单图标，根据collapse状态添加旋转类名 -->
    <svg-icon
      icon-name="ant-design:bars-outlined"
      custom-class="hamburger"
      :class="{ 'rotate-180': collapse }"
      @click="handleClick"
    ></svg-icon>
  </div>
</template>
<script setup lang="ts">
// 定义组件props，接收collapse状态
const { collapse } = defineProps({
  collapse: {
    type: Boolean,
    default: false
  }
})
// 定义组件事件emit，用于触发toggleCollapse事件
const emit = defineEmits<{ (e: "toggleCollapse"): void }>()
// 点击处理函数，触发toggleCollapse事件
const handleClick = () => {
  emit("toggleCollapse")
}
</script>

<style scoped lang="scss">
.hamburger-container {
  @apply leading-[50px] float-left cursor-pointer px-10px hover:(bg-black/5);
}
.hamburger {
  @apply w-30px h-30px transition-transform duration-300;
}
</style>
